import heapq


class Solution:
    def maximumScore(self, a: int, b: int, c: int) -> int:
        heap = [-a, -b, -c]
        heapq.heapify(heap)
        res = 0
        while True:
            i = -heapq.heappop(heap)
            j = -heapq.heappop(heap)
            if i == 0 or j == 0:
                break
            i -= 1
            j -= 1
            heapq.heappush(heap, -i)
            heapq.heappush(heap, -j)
            res += 1

        return res
